package com.asialjim.wechat.official.cloud;

import com.asialjim.wechat.official.apiservice.QrCodeService;
import com.asialjim.wechat.official.qrcode.QrCode;
import com.asialjim.wechat.official.qrcode.QrCodeProperty;
import com.asialjim.wechat.pojo.account.WeChatAccountHolder;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <h1><em>ASIAL JIM JAVA DOC</em></h1><hr/>
 * <h2>CLASS DESCRIPTION <i>[ NAME: QrCodeCloud ]</i></h2><strong>
 * <p> qr code cloud service
 * </strong><p><p><em>Copyright &copy; Asial Jim Co., LTD</em><hr/>
 *
 * @author Asial Jim &nbsp;&nbsp; <span>Email:<a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
 * @version 1.0.0
 * @since 2021/3/31   &nbsp;&nbsp; JDK 8
 */
@RestController
@AllArgsConstructor
@RequestMapping("/we_chat/official/qrcode")
public class QrCodeCloud {
    private final QrCodeService qrCodeService;

    @PostMapping("/create")
    public QrCode createQrCode(String ToUserName, @RequestBody QrCodeProperty qrCodeProperty){
        WeChatAccountHolder.setToUserName(ToUserName);
        return qrCodeService.createQrCode(qrCodeProperty);
    }
}